package com.example.hfSystem.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.example.hfSystem.entity.pojo.Announcement;
import com.example.hfSystem.dao.AnnouncementMapper;
import com.example.hfSystem.service.AnnouncementService;

import com.example.hfSystem.utils.PageUtils;
import com.example.hfSystem.utils.Query;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 公告信息表 服务实现类
 * </p>
 *
 * @author <a href="https://fengwenyi.com?fs=mpcg">Erwin Feng</a>
 * @since 2024-04-09
 */
@Service
public class AnnouncementServiceImpl extends ServiceImpl<AnnouncementMapper, Announcement> implements AnnouncementService {
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<Announcement> page = this.selectPage(
                new Query<Announcement>(params).getPage(),
                new EntityWrapper<Announcement>()
        );
        return new PageUtils(page);
    }

    @Override
    public PageUtils queryPage(Map<String, Object> params, Wrapper<Announcement> wrapper) {
        Page<Announcement> page =new Query<Announcement>(params).getPage();
        page.setRecords(baseMapper.selectListView(page,wrapper));
        PageUtils pageUtil = new PageUtils(page);
        return pageUtil;
    }

    @Override
    public List<Announcement> selectListVO(Wrapper<Announcement> wrapper) {
        return baseMapper.selectListVO(wrapper);
    }

    @Override
    public Announcement selectVO(Wrapper<Announcement> wrapper) {
        return baseMapper.selectVO(wrapper);
    }

    @Override
    public List<Announcement> selectListView(Wrapper<Announcement> wrapper) {
        return baseMapper.selectListView(wrapper);
    }

    @Override
    public Announcement selectView(Wrapper<Announcement> wrapper) {
        return baseMapper.selectView(wrapper);
    }

}
